import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shining_red_star/definitions/color.dart';
import 'package:shining_red_star/pages/color/detail.dart';
import 'package:shining_red_star/pages/color/index.dart';
import 'package:shining_red_star/pages/count_ducks.dart';
import 'package:shining_red_star/pages/home.dart';
import 'package:shining_red_star/pages/number/detail.dart';
import 'package:shining_red_star/pages/number/index.dart';
import 'package:shining_red_star/pages/pictorial.dart';
import 'package:shining_red_star/pages/pin_yin/detail.dart';
import 'package:shining_red_star/pages/pin_yin/index.dart';
import 'package:shining_red_star/pages/practice/color_practice.dart';
import 'package:shining_red_star/pages/practice/index.dart';
import 'package:shining_red_star/pages/practice/number_practice.dart';
import 'package:shining_red_star/pages/practice/shape_practice.dart';
import 'package:shining_red_star/pages/practice/some_thing_practice.dart';
import 'package:shining_red_star/pages/shape/detail.dart';
import 'package:shining_red_star/pages/shape/index.dart';
// import 'package:shining_red_star/pages/smb/browser.dart';
import 'package:shining_red_star/pages/some_thing/detail.dart';
import 'package:shining_red_star/pages/some_thing/index.dart';
import 'package:shining_red_star/widgets/focus_manage/focus_scope_manager.dart';

import 'definitions/router.dart';

class App extends StatelessWidget {
  const App({super.key});

  Widget wrapFocusScope(Widget child) {
    return FocusScopeManager(
      autofocus: true,
      child: child,
    );
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
        overlays: [SystemUiOverlay.bottom]);
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
        overlays: [SystemUiOverlay.top]);
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
    ));
    return MaterialApp(
      title: '红星闪耀',
      theme: ThemeData(
        colorScheme:
            ColorScheme.fromSeed(seedColor: SchemeColor.seedColor.value),
        useMaterial3: true,
      ),
      themeMode: ThemeMode.dark,
      darkTheme: ThemeData.dark(),
      routes: {
        RouterKey.home.value: (context) => wrapFocusScope(const HomePage()),
        RouterKey.pictorial.value: (context) =>
            wrapFocusScope(const PictorialPage()),
        RouterKey.someThing.value: (context) =>
            wrapFocusScope(const SomeThingIndexPage()),
        RouterKey.someThingDetail.value: (context) =>
            wrapFocusScope(const SomeThingDetailPage()),
        RouterKey.number.value: (context) =>
            wrapFocusScope(const NumberIndexPage()),
        RouterKey.numberDetail.value: (context) =>
            wrapFocusScope(const NumberDetailPage()),
        RouterKey.color.value: (context) =>
            wrapFocusScope(const ColorIndexPage()),
        RouterKey.colorDetail.value: (context) =>
            wrapFocusScope(const ColorDetailPage()),
        RouterKey.shape.value: (context) =>
            wrapFocusScope(const ShapeIndexPage()),
        RouterKey.shapeDetail.value: (context) =>
            wrapFocusScope(const ShapeDetailPage()),
        RouterKey.pinYin.value: (context) =>
            wrapFocusScope(const PinYinIndexPage()),
        RouterKey.pinYinDetail.value: (context) =>
            wrapFocusScope(const PinYinDetailPage()),
        RouterKey.practice.value: (context) =>
            wrapFocusScope(const PracticeIndexPage()),
        // RouterKey.smbBrowser.value: (context) =>
        //     wrapFocusScope(const SmbBrowserPage()),
        RouterKey.someThingPractice.value: (context) =>
            wrapFocusScope(const SomeThingPracticePage()),
        RouterKey.numberPractice.value: (context) =>
            wrapFocusScope(const NumberPracticePage()),
        RouterKey.colorPractice.value: (context) =>
            wrapFocusScope(const ColorPracticePage()),
        RouterKey.shapePractice.value: (context) =>
            wrapFocusScope(const ShapePracticePage()),
        RouterKey.countDucks.value: (context) => wrapFocusScope(const CountDucksPage()),
      },
      home: wrapFocusScope(const HomePage()),
    );
  }
}
